﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ch02
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            string[] deptName = { "开发部", "销售部", "后勤部", "售后服务部", "总经办" };
            //给下拉列表框添加选项
            for (int i = 0; i < deptName.Length; i++)
            {
                comboBox1.Items.Add(deptName[i]);
            }
            //设置默认第一项选中
            comboBox1.SelectedIndex = 0;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(comboBox1.Text);

            //MessageBox.Show(comboBox1.SelectedItem.ToString());
        }
    }
}
